//
//  BBDimView.m
//  xNose
//
//  Created by ben smith on 9/8/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "BBDimView.h"
#import "BBNodeController.h"


@implementation BBDimView

@synthesize canDrag;

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
		}
    return self;
}

- (void)drawRect:(NSRect)rect {
    // Drawing code here.
		[[NSColor colorWithDeviceWhite:0.0 alpha:0.5] set];
		[NSBezierPath fillRect:self.bounds];
}

// suck up all the mouse clicks
-(void)mouseDown:(NSEvent*)theEvent
{
	mouseDown = [theEvent locationInWindow];	
}

-(void)mouseUp:(NSEvent*)theEvent
{
}

-(void)mouseDragged:(NSEvent*)theEvent
{
	NSPoint newMouse = [theEvent locationInWindow];
	// then handle a frame shift
	if (canDrag) {
		float deltaX = newMouse.x - mouseDown.x;
		float deltaY = newMouse.y - mouseDown.y;
		[[BBNodeController sharedNodeController] scrollAllNodesX:deltaX y:deltaY animate:NO];		
	}	
	mouseDown = newMouse;
}


-(void)otherMouseDown:(NSEvent*)theEvent
{
	[self mouseDown:theEvent];
}

-(void)otherMouseUp:(NSEvent*)theEvent
{
}

-(void)otherMouseDragged:(NSEvent*)theEvent
{
	[self mouseDragged:theEvent];	
}


@end
